angular.module("httpService",[]).
service('staffService',function($http,$q){
  var baseUrl="http://ticketApi.milkedu.com";
    return {
        getDepartment:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/department/getAll'
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        getAll:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/staff/getAll'
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        getByCount:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/staff/getByCount',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
      getByKeywords:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:baseUrl+'/ticket/staff/getByKeywords',
          method:'post',
          data:data
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
        getByDepartmentId:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/staff/getByDepartmentId',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        update:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/staff/update',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                }
                else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
      updatePassword:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:baseUrl+'/ticket/staff/updatePassword',
          method:'post',
          data:angular.toJson(data)
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          }
          else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
        insert:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/staff/insert',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                }
                else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
          delete:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/staff/delete',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        getStaffInfoByCount:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/staff/getStaffInfoByCount',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        getStaffInfoByDepartment:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/staff/getStaffInfoByDepartment',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
      getStaffInfoByStaffId:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:baseUrl+'/ticket/staff/getStaffInfoByStaffId',
          method:'post',
          data:data
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
        validate:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/staff/validate',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response);
                }
                else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
      heartAuthority:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:baseUrl+'/ticket/staff/heartAuthority',
          method:'post',
          data:data
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response);
          }
          else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      }
    };
}).
service("relativeService",function ($http,$q) {
  var baseUrl="http://ticketApi.milkedu.com";
  return {
    insert:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/relatives/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function (response) {
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    delete:function(data){
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/relatives/delete',
        method:'post',
        data:data
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getByStaffId:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/relatives/getByStaffId',
        method:'post',
        data:angular.toJson(data)
      }).success(function (response) {
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
  }
}).
service("noticeService",function($http,$q){
  var baseUrl="http://ticketApi.milkedu.com";
    return {
         update:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/notice/update',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        insert:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/notice/insert',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
          delete:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/notice/delete',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
         getByCount:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/notice/getByCount',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        getAll:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/notice/getAll',
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        }
    };
}).
service("busesService",function($http,$q){
  var baseUrl="http://ticketApi.milkedu.com";
    return {
         update:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/buses/update',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                }
                else{
                    deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        insert:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/buses/insert',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                }
                else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
          delete:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/buses/delete',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
         getAll:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/buses/getAll',
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        getByBusOrderId:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/buses/getByBusOrderId',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        getInfo:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/buses/getInfo'
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        getInfoByCount:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/buses/getInfoByCount',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        getByBusOrderId:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/buses/getByBusOrderId',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
      getNearestBuses1:function(){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:baseUrl+'/ticket/buses/getNearestBuses1',
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
      getNearestBuses0:function(){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:baseUrl+'/ticket/buses/getNearestBuses0',
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      }
    };
}).
service("busOrderService",function($http,$q){
  var baseUrl="http://ticketApi.milkedu.com";
    return {
         update:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/busOrder/update',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        insert:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/busOrder/insert',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
          delete:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/busOrder/delete',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
         getAll:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/busOrder/getAll',
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        getByCount:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/busOrder/getByCount',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
      getNearestBusorder0:function(){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:baseUrl+'/ticket/busOrder/getNearestBusorder0'
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
      getNearestBusorder1:function(){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:baseUrl+'/ticket/busOrder/getNearestBusorder1'
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      }
    };
}).
service("noticeService",function($http,$q){
  var baseUrl="http://ticketApi.milkedu.com";
    return {
         update:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/notice/update',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        insert:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/notice/insert',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
          delete:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/notice/delete',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
         getAll:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/notice/getAll',
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        getByCount:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/notice/getByCount',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
    };
}).
service("departmentService",function($http,$q){
  var baseUrl="http://ticketApi.milkedu.com";
    return {
         update:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/department/update',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        insert:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/department/insert',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
          delete:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/department/delete',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
         getAll:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/department/getAll',
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        getByCount:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/department/getByCount',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
    };
}).
service("routesService",function($http,$q){
  var baseUrl="http://ticketApi.milkedu.com";
    return {
         update:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/routes/update',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
        insert:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/routes/insert',
                method:'post',
                data:angular.toJson(data)
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
          delete:function(data){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/routes/delete',
                method:'post',
                data:data
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        },
         getAll:function(){
            var deferred=$q.defer();
            var promise=deferred.promise;
            $http({
                url:baseUrl+'/ticket/routes/getAll',
            }).success(function(response){
                if (response.status==1001) {
                    deferred.resolve(response.body);
                } else {
                  deferred.reject(response);
                }
            }).error(function(){
              deferred.reject();
            });
            return promise;
        }

    };
}).
service("ticketOrderService",function ($http,$q) {
    var baseUrl="http://ticketApi.milkedu.com";
    return {
      insert:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:baseUrl+'/ticket/ticketOrder/insert',
          method:'post',
          data:angular.toJson(data)
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
      delete:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:baseUrl+'/ticket/ticketOrder/delete',
          method:'post',
          data:angular.toJson(data)
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
      getInfoByBusId:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:baseUrl+'/ticket/ticketOrder/getInfoByBusId',
          method:'post',
          data:angular.toJson(data)
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
      getValidateTicketsInfoByStaffId:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:baseUrl+'/ticket/ticketOrder/getValidateTicketsInfoByStaffId',
          method:'post',
          data:angular.toJson(data)
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
      getInvalidateTicketsInfoByStaffId:function(data){
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:baseUrl+'/ticket/ticketOrder/getInvalidateTicketsInfoByStaffId',
          method:'post',
          data:angular.toJson(data)
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
    }
  }).
service("settingService",function($http,$q){
  var baseUrl="http://ticketApi.milkedu.com";
  return {
    about:function () {
        var deferred=$q.defer();
        var promise=deferred.promise;
        $http({
          url:baseUrl+'/ticket/setting/about',
        }).success(function(response){
          if (response.status==1001) {
            deferred.resolve(response.body);
          } else {
            deferred.reject(response);
          }
        }).error(function(){
          deferred.reject();
        });
        return promise;
      },
    help:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/setting/help',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    version:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/setting/version',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    feedback:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/setting/feedback',
        method:"post",
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
    }

}).
service("carPoolingService",function ($http,$q) {
  var baseUrl="http://ticketApi.milkedu.com";
  return {
    getValidateCarPooling:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/carpooling/getValidateCarPooling'
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    insert:function (data) {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/carpooling/insert',
        method:'post',
        data:angular.toJson(data)
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    },
    getCategory:function () {
      var deferred=$q.defer();
      var promise=deferred.promise;
      $http({
        url:baseUrl+'/ticket/carpooling/getCategory',
      }).success(function(response){
        if (response.status==1001) {
          deferred.resolve(response.body);
        } else {
          deferred.reject(response);
        }
      }).error(function(){
        deferred.reject();
      });
      return promise;
    }
  }
});
